import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;

public class Pain {/*
    public static void main(String[] args) throws IOException {
        //得到图片缓冲区
//        BufferedImage bi = new BufferedImage(150, 70, BufferedImage.TYPE_INT_RGB);//INT精确度达到一定,RGB三原色，高度70,宽度150
        BufferedImage bi=ImageIO.read(new File("C:\\Users\\lingfengsan\\Desktop\\1.bmp"));
//得到它的绘制环境(这张图片的笔)
        Graphics2D g2 = (Graphics2D) bi.getGraphics();

//设置颜色
        g2.setColor(new Color(0,0,255));
        g2.setFont(new Font("宋体", Font.BOLD, 8)); //设置字体:字体、字号、大小

        g2.setColor(new Color(0,134,193));

        g2.drawString("坏坏", 11, 70); //向图片上写字符串
        ImageIO.write(bi,"JPEG", new FileOutputStream("F:/1a.jpg"));//保存图片 JPEG表示保存格式

    }*/
    public static void main(String[] args) {
        HashMap<Long,Integer> hashMap=new HashMap<>(140*10000);
        int num=100*10000;
        long a=0;
        for (int i = 0; i < num; i++) {
            hashMap.put(a++,i);
            if(i%100000==0){
                System.out.println("write "+i);
            }
        }
        long test=0;
        long cur=System.currentTimeMillis();
        for (long i = 0; i < num; i++) {
            test+=hashMap.get(i);
        }
        System.out.println(test);
        System.out.println("need "+(System.currentTimeMillis()-cur)+"ms");

    }
}
